package com.haipumi.listeners;

import java.util.List;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.haipumi.beans.haipumi_activity;
import com.haipumi.biz.IBackActivityBiz;
import com.haipumi.biz.impl.BackActivityBizImpl;
import com.haipumi.utils.CommonData;

public class ActivityListener implements ServletContextListener{
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		//访问数据库,得到所有的商品存到application中
		IBackActivityBiz iab=new BackActivityBizImpl();
		List<haipumi_activity> list=iab.findAllActivity();
		//如何取出application
		
		ServletContext application=arg0.getServletContext();
		application.setAttribute(CommonData.APPLICATIONACTIVITY, list);
	}
}
